// import playground from './modules/playground'
// import plugins from './modules/plugins'
// import components from './modules/components'

import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

/**
 * 在主框架内显示
 */
const frameIn = [
  {
    path: '/',
    redirect: { name: 'index' },
    component: layoutHeaderAside,
    children: [
      // 首页
      {
        path: 'index',
        name: 'index',
        meta: {
          title: '首页',
          auth: true
        },
        component: _import('system/index')
      },
      {
        path: 'timbreLibrary',
        name: 'timbreLibrary',
        meta: {
          title: '创建音色库',
          auth: true
        },
        component: _import('system/timbreLibrary')
      },    
      {
        path: 'voiceClone',
        name: 'voiceClone',
        meta: {
          title: '人声克隆',
          auth: true
        },
        component: _import('system/voiceClone')
      },    
      {
        path: 'audioDenoising',
        name: 'audioDenoising',
        meta: {
          title: '音频降噪',
          auth: true
        },
        component: _import('system/audioDenoising')
      },   
      {
        path: 'musicSeparation',
        name: 'musicSeparation',
        meta: {
          title: '背景音乐分离',
          auth: true
        },
        component: _import('system/musicSeparation')
      },
      {
        path: 'extractingAudio',
        name: 'extractingAudio',
        meta: {
          title: '视频提取音频',
          auth: true
        },
        component: _import('system/extractingAudio')
      },   
      {
        path: 'buyCharacters',
        name: 'buyCharacters',
        meta: {
          title: '购买字符',
          auth: true
        },
        component: _import('system/buyCharacters')
      },  
      {
        path: 'myrecord',
        name: 'myrecord',
        meta: {
          title: '我的记录',
          auth: true
        },
        component: _import('system/myrecord')
      },
      {
        path: 'problemFeedback',
        name: 'problemFeedback',
        meta: {
          title: '问题反馈',
          auth: true
        },
        component: _import('system/problemFeedback')
      },  
      {
        path: 'diyContent',
        name: 'diyContent',
        meta: {
          title: '定制内容',
          auth: true
        },
        component: _import('system/diyContent')
      }, 
      {
        path: 'aboutus',
        name: 'aboutus',
        meta: {
          title: '关于我们',
          auth: true
        },
        component: _import('system/aboutus')
      },
      
      // 系统 前端日志
      {
        path: 'log',
        name: 'log',
        meta: {
          title: '前端日志',
          auth: true
        },
        component: _import('system/log')
      },
      // 刷新页面 必须保留
      {
        path: 'refresh',
        name: 'refresh',
        hidden: true,
        component: _import('system/function/refresh')
      },
      // 页面重定向 必须保留
      {
        path: 'redirect/:route*',
        name: 'redirect',
        hidden: true,
        component: _import('system/function/redirect')
      }
    ]
  },
  // playground,
  // plugins,
  // components
]

/**
 * 在主框架之外显示
 */
const frameOut = [
  // 登录
  {
    path: '/login',
    name: 'login',
    component: _import('system/login')
  }
]

/**
 * 错误页面
 */
const errorPage = [
  {
    path: '*',
    name: '404',
    component: _import('system/error/404')
  }
]

// 导出需要显示菜单的
export const frameInRoutes = frameIn

// 重新组织后导出
export default [
  ...frameIn,
  // ...frameOut,
  ...errorPage
]
